// opens an info box
c_ImageOverlay.prototype.openInfoBox = function() {
  var idx = this.idx_;
  // quick check to make sure that if we're going to open this info box, then
  // its corresponding anchor should be showing
  //document.getElementById("name_field").childNodes[rank_idx].style.display = "";

  var cur_div = this.info_box_div_;

  if (cur_div.style.visibility == "hidden") {
    var height = 145;
    // get neighbors
    var nbrs = getNodeNeighbors(idx);
    // clear the current div 
    cur_div.innerHTML = "";
    // set anchor click fn
    var onclick_fn = "centerMap(imgmap, authorNodes[" + idx  + "].getCenter()); return false;";

    // padding space + text
    var p = document.createElement("P");
    //p.style.font = "16pt Helvetica #3d3d3d";
    p.style.fontSize = "12pt";
    p.style.fontWeight = "bold";
    p.style.paddingBottom = "0px";
    p.innerHTML = authorNames[idx];
    cur_div.appendChild(p);

    var p2 = document.createElement("P");
    p2.style.paddingBottom = "0px";
    p2.innerHTML = "Neighbors:";
    cur_div.appendChild(p2);

    // now write in neighbors
    for (i=0; i < nbrs.length; i++) {
      //var a = createAnchorControlDiv("", authorNames[nbrs[i]], "#", "authorNodes[" + idx + "].toggleInfoBox(); authorNodes[" + nbrs[i] + "].toggleInfoBox();");
      var a = createAnchorControlDiv("", authorNames[nbrs[i]], "#", "registerNodeClick(" + nbrs[i] + ");");
      a.id = "info_sub_link_sub2";
      cur_div.appendChild(a);
      height += 15;
    }

    cur_div.innerHTML += "<br>";

    // add buttons
    // center map
    cur_div.innerHTML += "<a href='#' id='info_sub_link' onclick='" + onclick_fn + "'><img src='images/center_button.png' border='0'></a>";
    // more info
    /*
    cur_div.innerHTML += "<a href='http://en.wikipedia.org/w/index.php?search=" + authorNames[idx] + "' target='_blank'><img src='images/more_info_button.png' border='0'></a>";
    */
    
    // a little 'close' anchor:
    cur_div.innerHTML += "<br>";
    cur_div.innerHTML += "<a id='info_sub_link_sub' href='#' onclick='return registerNodeClick(" + idx + ");'>[x] close</a>";
    //onclick='authorNodes[" + idx + "].toggleInfoBox(); return false;'>[x] close</a>";

    // set div style params
    cur_div.style.visibility = "visible";
    cur_div.style.display = "";
    cur_div.style.height = height+"px";
    //cur_div.style.width = "270px";
    // make variable width
    var width = p.innerHTML.length * 10;
    if (width < 235) {
      width = 235;
    }
    //set width
    cur_div.style.width = width + "px";
    cur_div.style.paddingLeft = "7px";
    //cur_div.style.paddingTop = "5px";
    cur_div.style.marginLeft = "15px";
    cur_div.style.marginRight = "auto";
    cur_div.style.marginTop = "15px";
    cur_div.style.marginBottom = "5px";
    cur_div.style.border = "1px solid black";
    cur_div.style.backgroundColor = "#ffffff";
  }
}

// closes an info box
c_ImageOverlay.prototype.closeInfoBox = function() {
  cur_div = this.info_box_div_;

  cur_div.style.visibility = "hidden";
  cur_div.style.marginTop = "0px";
  cur_div.style.marginBottom = "0px";
  cur_div.style.height = "0px";
}
